import {useNavigate} from "react-router-dom";
import {Button, Typography} from "antd";
import {MANAGE_INDEX_PATHNAME} from "../router";
import styles from './Home.module.scss'
import {useEffect} from "react";
// import axios from "axios";


const {Title, Paragraph} = Typography

export function Home() {
    const nav = useNavigate()

    useEffect(() => {
        // fetch('/api/test').then(res => res.json()).then(data => console.log(data))
        // axios.get('/api/test').then(res => console.log(res.data))
    }, [])

    function clickHandler() {
        // nav('/login?a=20')
        nav({
            pathname: '/login',
            search: 'b=20'
        })
    }

    return (
        <div className={styles.container}>
            <div className={styles.info}>
                <Title>问卷调查 | 在线投票</Title>
                <Paragraph>已积累创建问卷 100 份，发布问卷 90 份，收到答卷 980 份</Paragraph>
                <div>
                    <Button type={"primary"} onClick={() => {
                        nav(MANAGE_INDEX_PATHNAME)
                    }}>开始使用</Button>
                </div>
            </div>
        </div>
    );
}